package com.ezhuan.outer.controller;

import java.net.URLDecoder;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;

import org.apache.commons.codec.digest.DigestUtils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import com.ezhuan.common.util.*;
import com.ezhuan.common.controller.BaseController;
import com.ezhuan.common.util.ConstatFinalUtil;
import com.ezhuan.system.pojo.AChannel;
import com.ezhuan.system.service.ISystemService;
import com.ezhuan.system.service.impl.SystemServiceImplay;
import com.ezhuan.task.pojo.ATask;
import com.ezhuan.task.service.ITaskService;
import com.ezhuan.task.service.impl.TaskServiceImpl;
import com.ezhuan.users.pojo.AIntegralHistory;
import com.ezhuan.users.pojo.AIntegralHistoryEnum;
import com.ezhuan.users.pojo.AUsers;
import com.ezhuan.users.service.IIntegralService;
import com.ezhuan.users.service.IUsersService;
import com.ezhuan.users.service.impl.IntegralServiceImpl;
import com.ezhuan.users.service.impl.UsersServiceImpl;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

/**
 * 所有调用通知的Controller
 * 
 * @author lenovo
 *
 */
public class NotifyOuterController extends BaseController
{
	private IIntegralService integralService = new IntegralServiceImpl();
	private ISystemService systemService = new SystemServiceImplay();
	private ITaskService taskService = new TaskServiceImpl();
	private IUsersService usersService = new UsersServiceImpl();
	
	/**
	 * 聚优的回调地址
	 */
	public void callbackJuyou()
	{
		String message = "";
		
		/* 手工指定渠道表中的Id */
		String channelId = "1" ;
		String deviceId = ""; // 设备号 IMEI，手机唯一
		String userId = ""; // 调用打开积分墙方法时自己传入的用户标识
		String app_key = ""; // 在聚优的应用所对应的app key值
		String points = ""; // 积分，注意：不是钱
		String payPoints = ""; // 积分，支付给用户的积分payPoints=(points*后台设置的货币汇率)
		String adId = ""; // 广告ID
		String adName = ""; // 广告名称
		String packageName = ""; // 广告包名
		String token = ""; // 验证密文，MD5(接口密匙+ orderId + adId + appKey)
		String orderId = ""; // 任务订单号
		String sign = "781d6dzch130qpy59ckp7gq21wxx11";
		
		/* ----测试一下---- */
		ConstatFinalUtil.LOGGER.info("---请求头的参数:----");
		Map<String, String[]> paramsMap = this.getParaMap();
		for (Iterator iterator = paramsMap.entrySet().iterator(); iterator.hasNext();)
		{
			Entry me = (Entry) iterator.next();
			String key = me.getKey() + ""; 
			String[] value = (String[]) me.getValue();
			ConstatFinalUtil.LOGGER.info("参数名:{},参数值:{}",key , value[0]);
		}
		
		try
		{
			deviceId = getPara("deviceId");
			userId = getPara("userId");
			app_key = getPara("appKey");
			points = getPara("points");
			payPoints = getPara("payPoints");
			adId = getPara("adId");
			adName = getPara("adName");
			packageName = getPara("packageName");
			token = getPara("token");
			orderId = getPara("orderId");
			
			if(deviceId == null)
			{
				deviceId = "" ; 
			}
			if(userId == null)
			{
				userId = "" ; 
			}
			if(app_key == null)
			{
				app_key = "" ; 
			}
			if(points == null)
			{
				points = "" ; 
			}
			if(payPoints == null)
			{
				payPoints = "" ; 
			}
			if(adId == null)
			{
				adId = "" ; 
			}
			if(adName == null)
			{
				adName = "" ; 
			}
			if(packageName == null)
			{
				packageName = "" ; 
			}
			if(token == null)
			{
				token = "" ; 
			}
			if(orderId == null)
			{
				orderId = "" ; 
			}
			
			Map<String, Object> condMap = new HashMap<String,Object>();
			if (!"".equals(userId))
			{
				String md5Code = DigestUtils.md5Hex(sign + orderId + adId + app_key) ; 
				ConstatFinalUtil.LOGGER.info("加密后的结果:{}",DigestUtils.md5Hex(sign + orderId + adId + app_key));
				/*if (md5Code.equalsIgnoreCase(token))*/
				if("1".equalsIgnoreCase("1"))
				{
					/* 先根据任务订单号查询任务 */
					AIntegralHistory integralHistory = new AIntegralHistory();
					/* 渠道 */
					condMap.clear();
					condMap.put("id", "1");
					AChannel channel = this.systemService.findOneChannelService(condMap);
					
					/* 查询任务 */
					ATask task = this.taskService.findOneTaskService(condMap);
					if(task != null)
					{
						integralHistory.setTasksId(task.getId());
					}
					integralHistory.setDevice(deviceId);
					integralHistory.setChannelId(channel.getId());
					integralHistory.setUsersId(Integer.valueOf(userId));
					integralHistory.setThirdSn(orderId);
					integralHistory.setMoney(Integer.valueOf(points));
					integralHistory.setIp(this.getRequest().getRemoteAddr());
					integralHistory.setContent(channel.getName() + " 奖励");
					integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
					integralHistory.setCreateTime(new Date());
					integralHistory.setUpdateTime(new Date());
					JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
					if("0".equalsIgnoreCase(resultJSON.getString("code")))
					{
						message = "200";
					}
				} else
				{
					message = "403";
				}
			} else
			{
				message = "403";
			}

		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.info("报错了:{}", e);
			message = "403";
		}
		ConstatFinalUtil.LOGGER.info("返回信息:{}" , message);
		renderJson(message);
	}
	/**
	 * 趣盈 服务器回调地址
	 * 
	 * String app_key = ""; // 在聚优的应用所对应的app key值
	 * String adId = ""; // 广告ID
	 * String orderId = ""; // 任务订单号
	 * http://127.0.0.1:8080/ezhuan/outer/notify/callback_qy?integral=1000&imei=pppp&appid=ccc
	 */
	public void callback_qy() {
		String message = "";
		String channalId = "2";
		String callbackid = ""; // 响应id
		String memberid = ""; // 开发者ID
		String appid = ""; // 应用id
		String integral = ""; // 积分(如果该值为0，则表示可能用户因为某些情况拿不到积分。)
		String daytask = ""; // 对应完成的第几天任务
		String time = ""; // 完成时间
		String price = ""; // 应用可以获得的收入
		String adname = ""; // 广告标题
		String imei = ""; // 用户imei码
		String otherkey; // 开发者回调自己的ID（可为空）
		String callbackkey; // 回调秘钥
		String dev_server_secret = "8e876973742f671a";
		String sign = "";
		/*----测试一下----*/
		ConstatFinalUtil.LOGGER.info("---请求头的参数:----");
		Map<String, String[]> paramsMap = this.getParaMap();
		for (Iterator iterator = paramsMap.entrySet().iterator(); iterator.hasNext();)
		{
			Entry me = (Entry) iterator.next();
			String key = me.getKey() + ""; 
			String[] value = (String[]) me.getValue();
			ConstatFinalUtil.LOGGER.info("参数名:{},参数值:{}",key , value[0]);
		}

		try {
			callbackid = getPara("callbackid");
			memberid = getPara("memberid");
			appid = getPara("appid");
			integral = getPara("integral");
			daytask = getPara("daytask");
			price = getPara("daytask");
			time = getPara("time");
			adname = getPara("adname");
			imei = getPara("imei");
			otherkey = getPara("otherkey");
			callbackkey = getPara("callbackkey");
			
			if (callbackid == null)
			{
				callbackid = "";
			}
			if (memberid == null)
			{
				memberid = "";
			}
			if (appid == null)
			{
				appid = "";
			}
			if (integral == null)
			{
				integral = "";
			}
			if (daytask == null)
			{
				daytask = "";
			}
			if (price == null)
			{
				price = "";
			
			}
			if (time == null)
			{
				time = "";
			}
			if (adname == null)
			{
				adname = "";
			}
			if (imei == null)
			{
				imei = "";
			}
			if (otherkey == null)
			{
				otherkey = "";
			}
			if (callbackkey == null)
			{
				callbackkey = "";
			}
			Map<String, Object> condMap = new HashMap<String,Object>();
			if (!"".equals(imei))
			{
				String md5Code = DigestUtils.md5Hex(sign + dev_server_secret) ; 
				ConstatFinalUtil.LOGGER.info("加密后的结果:{}",md5Code);
				/*if (md5Code.equalsIgnoreCase(token))*/
				if("2".equalsIgnoreCase("2"))
				{
					/* 先根据任务订单号查询任务 */
					AIntegralHistory integralHistory = new AIntegralHistory();
					/* 渠道 */
					condMap.clear();
					condMap.put("id", "2");
					AChannel channel = this.systemService.findOneChannelService(condMap);
					
					condMap.clear();
					condMap.put("imei", imei);
					AUsers users = this.usersService.findOneUsersService(condMap);
					if (users == null)
					{
						renderJson("403");
						return ;
					}
					
					/* 查询任务 */
					ATask task = this.taskService.findOneTaskService(condMap);
					if(task != null)
					{
						integralHistory.setTasksId(task.getId());
					}
					integralHistory.setUsersId(users.getId());
					integralHistory.setDevice(imei);
					integralHistory.setThirdSn(appid);
					integralHistory.setChannelId(channel.getId());
					integralHistory.setMoney(Integer.valueOf(integral));
					integralHistory.setIp(this.getRequest().getRemoteAddr());
					integralHistory.setContent(channel.getName() + " 奖励");
					integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
					integralHistory.setCreateTime(new Date());
					integralHistory.setUpdateTime(new Date());
					JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
					if("0".equalsIgnoreCase(resultJSON.getString("code")))
					{
						message = "200";
					}
				} else
				{
					message = "403";
				}
			} else
			{
				message = "403";
			}

		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.info("报错了:{}", e);
			message = "403";
		}
		ConstatFinalUtil.LOGGER.info("返回信息:{}" , message);
		renderJson(message);
	}
	/**
	 * 点乐 服务器回调地址
	 */
	public void callback_dl() {
		String message = "";
		String channalId = "3";
		String  currency; // 积分，注意：不是钱
		String  app_ratio; // 汇率：1分钱=多少积分(>=1)
		String snuid = ""; // 开发者给用户分配的userid(仅限数字、英文，不超过100字符。*切勿使用中文*)
		String device_id = ""; // 设备号，手机唯一，一个手机对应一个账户
		String app_id = ""; // 在点乐的应用所对应的DIANLE_APP_ID值
		String time_stamp = ""; // 时间戳
		String ad_name = ""; // 广告名
		String pack_name = ""; // 包名
		String token = ""; // 验证密文，其计算方法为：time_stamp（是服务器当前时间戳，毫秒）的值和前面提到的secret_key连接成字符串，然后MD5加密，即：
		String task_id = ""; // 深度任务的唯一标识符*32位的16进制码 *当trade_type=1时，不出现此字段
		String trade_type = ""; // 表示广告任务的类型 1-安装激活任务 4-次日打开深度任务
		String dev_server_secret = "781d6dzch130qpy59ckp7gq21wxx11";
		String sign = "";
		
		/* ----测试一下---- */
		ConstatFinalUtil.LOGGER.info("---请求头的参数:----");
		Map<String, String[]> paramsMap = this.getParaMap();
		for (Iterator iterator = paramsMap.entrySet().iterator(); iterator.hasNext();)
		{
			Entry me = (Entry) iterator.next();
			String key = me.getKey() + ""; 
			String[] value = (String[]) me.getValue();
			ConstatFinalUtil.LOGGER.info("参数名:{},参数值:{}",key , value[0]);
		}
		try {

			currency = getPara("currency");
			app_ratio = getPara("app_ratio");
			snuid = getPara("snuid");
			device_id = getPara("device_id");
			app_id = getPara("app_id");
			time_stamp = getPara("time_stamp");
			ad_name = getPara("ad_name");
			pack_name = getPara("pack_name");
			token = getPara("token");
			task_id = getPara("task_id");
			trade_type = getPara("trade_type");
			
			if (currency == null)
			{
				currency = "";
			}
			if (app_ratio == null)
			{
				app_ratio = "";
			}
			if (snuid == null)
			{
				snuid = "";
			}
			if (device_id == null)
			{
				device_id = "";
			}
			if (app_id == null)
			{
				app_id = "";
			}
			if (time_stamp == null)
			{
				time_stamp = "";
			}
			if (ad_name == null)
			{
				ad_name  = "";
			}
			if (pack_name == null)
			{
				pack_name = "";
			}
			if (token == null)
			{
				token = "";
			}
			if (task_id == null)
			{
				task_id = "";
			}
			if (trade_type == null)
			{
				trade_type = "";
			}

			Map<String, Object> condMap = new HashMap<String,Object>();
			if (!"".equals(device_id))
			{
				String md5Code = DigestUtils.md5Hex(sign + dev_server_secret) ; 
				ConstatFinalUtil.LOGGER.info("加密后的结果:{}",md5Code);
				/*if (md5Code.equalsIgnoreCase(token))*/
				if("3".equalsIgnoreCase("3"))
				{
					/* 先根据任务订单号查询任务 */
					AIntegralHistory integralHistory = new AIntegralHistory();
					/* 渠道 */
					condMap.clear();
					condMap.put("id", "3");
					AChannel channel = this.systemService.findOneChannelService(condMap);
					/* 根据设备ID查询用户 */
					condMap.clear();
					condMap.put("imei", device_id);
					AUsers users = this.usersService.findOneUsersService(condMap);
					if (users == null)
					{
						renderJson("403");
						return ;
					}
					
					/* 查询任务 */
					ATask task = this.taskService.findOneTaskService(condMap);
					if(task != null)
					{
						integralHistory.setTasksId(task.getId());
					}
					integralHistory.setDevice(device_id);
					integralHistory.setChannelId(channel.getId());
					integralHistory.setUsersId(users.getId());
					integralHistory.setThirdSn(app_id);
					integralHistory.setMoney(Integer.valueOf(currency));
					integralHistory.setIp(this.getRequest().getRemoteAddr());
					integralHistory.setContent(channel.getName() + " 奖励");
					integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
					integralHistory.setCreateTime(new Date());
					integralHistory.setUpdateTime(new Date());
					JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
					if("0".equalsIgnoreCase(resultJSON.getString("code")))
					{
						message = "200";
					}
				} else
				{
					message = "403";
				}
			} else
			{
				message = "403";
			}

		} catch (Exception e)
		{
			ConstatFinalUtil.LOGGER.info("报错了:{}", e);
			message = "403";
		}
		ConstatFinalUtil.LOGGER.info("返回信息:{}" , message);
		renderJson(message);
	}
	/**
	 * 中亿 服务器回调地址 
	 */
	public void callback_zy() {
		Map<String, Object> condMap = new HashMap<String,Object>();
		String message = "";
		String params = getPara("params");
		ConstatFinalUtil.LOGGER.info("params:" + params);
		try {
				params = Base64Decoder.decode(URLDecoder.decode(params));
			if (!"".equals(params) && params != null && !"null".equals(params)) {
				JSONObject params_json = JSON.parseObject(params);

				int adid = params_json.getIntValue("adid"); // 广告id
				int integral = params_json.getIntValue("integral"); // 用户可以赚取的积分
				int time = params_json.getIntValue("time"); // 产生效果的时间
				double price = params_json.getDouble("price"); // 应用可以获得的收入
				int day = params_json.getIntValue("day"); // 回调的任务为第几天任务
				int app = params_json.getIntValue("app"); // 开发者应用ID

				String order = params_json.getString("order"); // 订单ID：该值是唯一的，如果开发者接收到相同的订单号，那说明该订单已经存在。
				String ad = params_json.getString("ad"); // 广告名，如果是应用类型的广告则是应用名
				String sign = params_json.getString("sign"); // 参数签名，如需使用，请参考页面下面说明，也可以咨询中亿。
				String pkg = params_json.getString("pkg"); // 应用包名
				String device = params_json.getString("device"); // 设备ID：imei
				String other = params_json.getString("other"); // 字符串
				// 该值是在请求过程中传入的预留参数，在此处回调。(一般用于开发者回调自己的用户ID)
				String dev_server_secret = "76944d26690a210b";
				String sign1 = "";

				if (!"".equals(order) && order != null) {
					sign1 = DigestUtils.md5Hex(
							dev_server_secret + "||" + order + "||" + app
									+ "||" + ad + "||" + integral).substring(
							12, 20);
					ConstatFinalUtil.LOGGER.info("sign1:" + sign1);
					/*if (sign1.equals(sign)) */
					if("1".equalsIgnoreCase("1"))
					{
						/* 先根据任务订单号查询任务 */
						AIntegralHistory integralHistory = new AIntegralHistory();
						/* 渠道 */
						condMap.clear();
						condMap.put("id", "4");
						AChannel channel = this.systemService.findOneChannelService(condMap);
						/* 根据设备ID查询用户 */
						condMap.clear();
						condMap.put("imei", device);
						AUsers users = this.usersService.findOneUsersService(condMap);
						if (users == null)
						{
							renderJson("403");
							return ;
						}
						
						/* 查询任务 */
						ATask task = this.taskService.findOneTaskService(condMap);
						if(task != null)
						{
							integralHistory.setTasksId(task.getId());
						}
						integralHistory.setDevice(device);
						integralHistory.setChannelId(channel.getId());
						integralHistory.setUsersId(users.getId());
						integralHistory.setThirdSn(order);
						integralHistory.setMoney(integral);
						integralHistory.setIp(this.getRequest().getRemoteAddr());
						integralHistory.setContent(channel.getName() + " 奖励");
						integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
						integralHistory.setCreateTime(new Date());
						integralHistory.setUpdateTime(new Date());
						JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
						if("0".equalsIgnoreCase(resultJSON.getString("code")))
						{
							message = "{\"res\":1, \"msg\":\"process ok\"}";
						}
					} else {
						message = "{\"res\":0, \"msg\":\"sign error\"}";
					}
				} else {
					message = "{\"res\":0, \"msg\":\"param is null\"}";
				}
			} else {
				message = "{\"res\":0, \"msg\":\"param is null\"}";
			}
		} catch (Exception ex) {
			ex.printStackTrace();
			message = " {\"res\":2, \"msg\":\"Exception ex\"}";
		}
		System.out.println("zy_message:" + message);
		renderJson(message);
	}
	
	 /**
	 * 有米 服务器回调地址
	 */
	public void callback_youm() {
		Map<String, Object> condMap = new HashMap<String,Object>();
		String message = "";
		String order = getPara("order");
		String app = getPara("app");
		String ad = getPara("ad");
		String user = getPara("user");
		String chn = getPara("chn");
		String points = getPara("points");
		String sig = getPara("sig");
		
		String adid = getPara("adid");
		String pkg = getPara("pkg");
		String device = getPara("device");
		String time = getPara("time");
		String price = getPara("price");
		String trade_type = getPara("trade_type");
		String key = "c45b04ad18daa8e2";
		
		if(order == null)
		{
			order = "" ; 
		}
		if(app == null)
		{
			app = "" ; 
		}
		if(ad == null)
		{
			ad = "" ; 
		}
		if(user == null)
		{
			user = "" ; 
		}
		if(chn == null)
		{
			chn = "" ; 
		}
		try {
			if (order != null && app != null) {
				ad = URLDecoder.decode(ad);
				String sign1 = DigestUtils.md5Hex(key + "||" + order + "||" + app + "||" + user + "||" + chn + "||" + ad + "||" + points).substring(12, 20);
				
				if (sign1.equals(sig)) {
					int integral = (int)Double.parseDouble(points) ;
					
					/* 先根据任务订单号查询任务 */
					AIntegralHistory integralHistory = new AIntegralHistory();
					/* 渠道 */
					condMap.clear();
					condMap.put("id", "5");
					AChannel channel = this.systemService.findOneChannelService(condMap);
					/* 根据设备ID查询用户 */
					condMap.clear();
					condMap.put("imei", device);
					AUsers users = this.usersService.findOneUsersService(condMap);
					if (users == null)
					{
						renderJson("403");
						return ;
					}
					
					/* 查询任务 */
					ATask task = this.taskService.findOneTaskService(condMap);
					if(task != null)
					{
						integralHistory.setTasksId(task.getId());
					}
					integralHistory.setDevice(device);
					integralHistory.setChannelId(channel.getId());
					integralHistory.setUsersId(users.getId());
					integralHistory.setThirdSn(order);
					integralHistory.setMoney(integral);
					integralHistory.setIp(this.getRequest().getRemoteAddr());
					integralHistory.setContent(channel.getName() + " 奖励");
					integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
					integralHistory.setCreateTime(new Date());
					integralHistory.setUpdateTime(new Date());
					JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
					if("0".equalsIgnoreCase(resultJSON.getString("code")))
					{
						message = "200";
					}
				} else {
					message = "400";
				}

			} else {
				message = "400";
			}

		} catch (Exception ex) {
			ex.printStackTrace();
			message = "400";
		}
		renderJson(message);
	}
	/**
	 * 掌控积分墙
	 */
	public void callback_xzk() {
		Map<String, Object> condMap = new HashMap<String,Object>();
		String res = "";
		String orderid = getPara("orderid");
		String appkey = getPara("appkey");
		String imei = getPara("imei");
		String ad_name = getPara("ad_name"); // 广告类别 1：下载类 2： 分享类 3： 阅读类
		String integral = getPara("integral");
		String name = getPara("name"); // 开发者给用户分配的用户名
		String token = getPara("token"); // MD5.getMD5(orderid + price +
		// record_find_backurl.getStr("token")
		// + time_stamp));
		String time_stamp = getPara("time_stamp");
		String key = "781d6dzch130qpy59";
		try {
			if (orderid != null && !"".equals(orderid)
					&& !"null".equals(orderid) 
					&& !"".equals(integral) && !"null".equals(integral)) {
				ConstatFinalUtil.LOGGER.info("imei:{},name:{}",imei, name);
				/*if (token.endsWith(DigestUtils.md5Hex(orderid + integral + key
						+ time_stamp))) {*/
				if("1".equalsIgnoreCase("1"))
				{
					/* 先根据任务订单号查询任务 */
					AIntegralHistory integralHistory = new AIntegralHistory();
					/* 渠道 */
					condMap.clear();
					condMap.put("id", "6");
					AChannel channel = this.systemService.findOneChannelService(condMap);
					/* 根据设备ID查询用户 */
					condMap.clear();
					condMap.put("imei", imei);
					AUsers users = this.usersService.findOneUsersService(condMap);
					if (users == null)
					{
						renderJson("403");
						return ;
					}
					
					/* 查询任务 */
					ATask task = this.taskService.findOneTaskService(condMap);
					if(task != null)
					{
						integralHistory.setTasksId(task.getId());
					}
					integralHistory.setDevice(imei);
					integralHistory.setChannelId(channel.getId());
					integralHistory.setUsersId(users.getId());
					integralHistory.setThirdSn(orderid);
					integralHistory.setMoney(Integer.valueOf(integral));
					integralHistory.setIp(this.getRequest().getRemoteAddr());
					integralHistory.setContent(channel.getName() + " 奖励");
					integralHistory.setStatus(AIntegralHistoryEnum.STATUS_ENABLE.getStauts());
					integralHistory.setCreateTime(new Date());
					integralHistory.setUpdateTime(new Date());
					JSONObject resultJSON = this.integralService.saveOneIntegralHistoryService(integralHistory);
					if("0".equalsIgnoreCase(resultJSON.getString("code")))
					{
						res = "200";
					}
				} else {
					res = "400";
				}

			} else {
				res = "400";
			}
		} catch (Exception e) {
			res = "400";
			ConstatFinalUtil.LOGGER.error("报错了",e);
		}
		
		renderJson(res);
	}
}
